#include <iostream>
#include <vector>

using namespace std;

int eatMemory(long long sizeToEat) {
	vector<char*> charArrays;
	long long sum = 0;
	int a = 1 << 22;
	for (int blockSize = 1 << 22; blockSize > 0; blockSize >>= 1) {
		for (;sizeToEat >= blockSize; sizeToEat -= blockSize) {
			try {
				char* arr = new char[blockSize];
				charArrays.push_back(arr);
				sum += blockSize;
				cout << sum << endl;
			} catch(...) {
				cout << "finish " << blockSize << "\n";
				break;
			}
		}
	}
	for (size_t i = 0; i < charArrays.size(); ++i) {
		delete[] charArrays[i];
	}
	return 0;
}

int main(void) {
	eatMemory(10546324);
	return 0;
}